package com.ruoyi.food.handle;


import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.core.type.TypeReference;
import com.ruoyi.food.domain.dto.FoodAdditionDTO;

import java.io.IOException;
import java.util.List;

/**
 * 加料列表类型处理程序
 *
 * @author Administrator
 * @date 2023/03/15
 */
public class AdditionListTypeHandler extends JacksonTypeHandler {

    public AdditionListTypeHandler(Class<?> type) {
        super(type);
    }

    @Override
    protected Object parse(String json) {
        try {
            return getObjectMapper().readValue(json, new TypeReference<List<FoodAdditionDTO>>() {
            });
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }


}
